package com.icxcc.controller;

import com.icxcc.constant.RabbitConstant;
import com.icxcc.service.RabbitMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("rabbit")
public class RabbitController {

    @Autowired
    RabbitMessageService rabbitMessageService;
    @PostMapping("send")
    public String send(String message){
        rabbitMessageService.send(RabbitConstant.DELAY_PROCESS_QUEUE,message);
        return "请求成功";
    }

    @PostMapping("sendDelay")
    public String send(String message, long times){
        rabbitMessageService.send(RabbitConstant.DELAY_PROCESS_QUEUE,message, times);
        return "请求成功";
    }
}
